package org.cshoo.capua.connector;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.stereotype.Controller;
import reactor.core.publisher.Mono;

@Controller
public class CustomerConnector {

    @MessageMapping("message")
    public Mono<String> message(Mono<String> message) {
        System.out.println("CustomerConnector#message");
        return message.doOnNext(msg -> {
            System.out.println("hello world");
            System.out.println("接收到消息:" + msg);
        }).map(msg -> "message back");
    }

    @MessageMapping("message1")
    public Mono<String> message1(Mono<String> message) {
        System.out.println("CustomerConnector#message1");
        return message.doOnNext(msg -> {
            System.out.println("hello world");
            System.out.println("接收到消息:" + msg);
        }).map(msg -> "message1 back");
    }

}
